import java.io.FileWriter;
import java.io.IOException;

public class FileWriterDemo09 {
    public static void main(String[] args) throws IOException {
        FileWriter fileWriter = new FileWriter("F:\\IdeaProjects\\MyJava230203\\day27\\dir\\2.txt", true);
        // 写字符串
        fileWriter.write("床前明月光");



        // 写char数组
        String s = "男儿志在四方";
        char[] chars = s.toCharArray();// 字符串转char数组的方法
        fileWriter.write(chars);
        fileWriter.flush();// 关闭之前，调用一下，把IO管道数据都写出去
        fileWriter.close();
    }
}
